package com.itheima.demo;

import com.itheima.pojo.UserInfo;
import com.itheima.service.UserInfoService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo {

    public static void main(String[] args) {
        //1. 创建spring IOC容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("spring.xml");
        //2. 获取bean对象
        UserInfoService userInfoService = ac.getBean(UserInfoService.class);
        //3. 调用service层
        UserInfo userInfo = userInfoService.findById(1);
        //4. 打印结果
        System.out.println(userInfo);
    }
}
